<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .top {
            width: 0;
            height: 0;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
            border-bottom: 50px solid yellowgreen;
        }

        /* 画三角形都从这个角度出发 */
        .test-border { 
            margin: 20px;
            width: 0;
            height: 0;
            background-color: goldenrod;
            border-left: 50px solid red;
            border-right: 50px solid blue;
            border-bottom: 50px solid yellowgreen;
            border-top: 50px solid pink;
        }
    </style>
</head>
<body>
    <div class="triangle top"></div>
    <div class="triangle bottom"></div>
    <div class="triangle left"></div>
    <div class="triangle right"></div>
    <div class="test-border"></div>
</body>
</html>